#ifndef _TRIANGLE_H_
#define _TRIANGLE_H_

#ifdef _DEBUG
#include "Assert.h"
#endif

#include "../cuCommon/cuTypes.h"
#include "../cuCommon/cuMath.h"

struct STriangle
{
    float3 m_V[3];
};

SDH_CALL STriangle * Triangle(STriangle * pTriangle)
{
    set(pTriangle->m_V[0], 0.0f, 0.0f, 0.0f);
    set(pTriangle->m_V[1], 1.0f, 0.0f, 0.0f);
    set(pTriangle->m_V[2], 0.0f, 1.0f, 0.0f);

    return pTriangle;
}

SDH_CALL STriangle * Triangle(STriangle * pTriangle, const float3 & v0, const float3 & v1, const float3 & v2)
{
    set(pTriangle->m_V[0], v0.x, v0.y, v0.z);
    set(pTriangle->m_V[1], v1.x, v1.y, v1.z);
    set(pTriangle->m_V[2], v2.x, v2.y, v2.z);

    return pTriangle;
}

SDH_CALL STriangle * Triangle(STriangle * pTriangle, const float4 & v0, const float4 & v1, const float4 & v2)
{
    set(pTriangle->m_V[0], v0.x, v0.y, v0.z);
    set(pTriangle->m_V[1], v1.x, v1.y, v1.z);
    set(pTriangle->m_V[2], v2.x, v2.y, v2.z);

    return pTriangle;
}

class CKeyValue
{
public:
	float key;
	float value;

	friend bool operator < (const CKeyValue & l, const CKeyValue & r);
	friend bool operator > (const CKeyValue & l, const CKeyValue & r);
};

SDH_CALL
bool operator < (const CKeyValue & l, const CKeyValue & r)
{
	if (l.value < r.value)
		return true;
	else
		return false;
}

SDH_CALL
bool operator > (const CKeyValue & l, const CKeyValue & r)
{
	if (l.value > r.value)
		return true;
	else
		return false;
}


#endif // 